package com.zy;


/**
 * Created by zhaoyi on 2019/10/9.
 * 测试
 */
public class Functional {
    public static void main(String[] args) {
        Foo foo = (int a, int b) -> {
            System.out.println(a + b);
            return b;
        };
        foo.say(1, 2);
        System.out.println(foo.mul(2, 2));
        System.out.println(Foo.dev(2, 2));
    }

}


//函数式接口有且只有一个方法的==申明==, 实现的可以是多个
@FunctionalInterface
interface Foo {

    int say(int x, int y);

    default int mul(int x, int y) {
        return x * y;
    }

    static int dev(int x, int y) {
        return x / y;
    }

}